package cases.boxes 
{
	import flash.events.Event;
	import org.despair2D.ui.events.ManipulateEvent;
	import org.despair2D.ui.FrameRange;
	import org.despair2D.ui.LabelButton;
	import org.despair2D.ui.PersonaState;
	import org.despair2D.ui.Spinner;
	
	public class RangeState extends PersonaState 
	{
		
		
		override public function enter() : void
		{
			this.group.move(100,100)
			
			var fr:FrameRange = new FrameRange('HP_A', 30)
			this.group.addFusion(fr)
			fr.addEventListener(Event.CHANGE, function(e:Event):void
			{
				trace(fr.value)
			})
			
			var back:LabelButton
			var forward:LabelButton
			
			back = new LabelButton('Btn_A', 'back 1');
			this.group.addFusion(back)
			back.addEventListener(ManipulateEvent.CLICK, function(e:ManipulateEvent):void
			{
				fr.value -= 1
				//trace(fr.value)
			})
			back.move(10, 80);
			
			forward = new LabelButton('Btn_A', 'forward 1');
			this.group.addFusion(forward)
			forward.addEventListener(ManipulateEvent.CLICK, function(e:ManipulateEvent):void
			{
				fr.value += 1
				//trace(fr.value)
			})
			forward.move(90, 80)
			
			back = new LabelButton('Btn_A', 'back 10');
			this.group.addFusion(back)
			back.addEventListener(ManipulateEvent.CLICK, function(e:ManipulateEvent):void
			{
				fr.value -= 10
				//trace(fr.value)
			})
			back.move(10, 150);
			
			forward = new LabelButton('Btn_A', 'forward 10');
			this.group.addFusion(forward)
			forward.addEventListener(ManipulateEvent.CLICK, function(e:ManipulateEvent):void
			{
				fr.value += 10
				//trace(fr.value)
			})
			forward.move(90, 150)
			
			var spinner:Spinner = new Spinner(0, 0, 100, 'Btn_A', 'Btn_A');
			this.group.addFusion(spinner)
			spinner.move(10, 210);
			spinner.addEventListener(Event.CHANGE, function(e:Event):void
			{
				trace(spinner.value)
			})
		}
	}

}